import sys
sys.path.append("Controller")
sys.path.append("Data")
sys.path.append("Model")
sys.path.append("View")
from cont_insert_bdd import CLS_ContlInsertBdd
from cont_read_xls import CLS_ContlReadXls
from view_plot_data import AppPlot

def main():

	print "\n\nSTART APPLICATION ?\n\nY - Yes\nN - No\n"

	charInConsole = raw_input()

	if charInConsole == 'Y':

		openXls = CLS_ContlReadXls()
	   	xlsSheetToBdd = openXls.funcContlReadXls()

	   	appMakeBdd = CLS_ContlInsertBdd()	

		if appMakeBdd.funcMakeDataBase(xlsSheetToBdd) == True:

			raw_input("\n\nData inserted in BDD ...\n\nANY KEY TO CONTINUE ...")

			drawPlot = AppPlot()
			
			strTitlePplot = "TITULO PLOT"
			#womenMeans = (25, 32, 34, 20, 25)
			#labelX = "LABEL - X"
			#labelY = "LABEL - Y"
			#xTickLabels = ('G1', 'G2', 'G3', 'G4', 'G5')
#			drawPlotImg = drawPlot.plotImg()
			drawPlotImg = drawPlot.plotImg(strTitlePplot)
			#drawPlot.plotImg(womenMeans, strTitlePplot, labelX, labelY, xTickLabels)

			raw_input("\n\nPLOT OK ...\n\nANY KEY TO CONTINUE ...")

		else:
		
			raw_input("\n\nANY KEY TO EXIT ...")
			sys.exit()

	elif charInConsole == 'N':

	    raw_input("\n\nANY KEY TO EXIT ...")

	elif (charInConsole != 'N') and (charInConsole != 'N'):

		raw_input("\n\n(Y)es or (N)o ...\n\nANY KEY TO CONTINUE ...")
		main()

	else:
		sys.exit()

main()